#ifndef CLUSTER_H
#define CLUSTER_H

#include <list>
#include <string>
#include <pthread.h>
#include <iostream>
#include <fstream>
#include <exception>
#include <boost/regex.hpp>
#include "node.h"

using namespace std;

class Cluster {
	private:
	list<Node*> *nodes;
	list<Node*> *active;
	list<Node*> *online;
	list<pthread_t*> threads;
	list<pthread_t*>::iterator t;
	list<string*> *console;
	string hostfile;
	bool usecache;
	void findNodes();
	public:
	Cluster(string hosts, bool cached, list<string*> *output);
	Cluster(string hosts, bool cached);
	void resetNodes();
	void setNodeOnline(string *ip, bool online);
	void setNodeActive(string *ip, bool active);
	bool isNodeOnline(string *ip);
	bool isNodeActive(string *ip);
	bool isUsingCache();
	bool setUseCache(bool use);
	void execute(list<Node*> *nodes, string *command);
	void probe();
	list<Node*> *getOnlineNodes();
	list<Node*> *getActiveNodes();
	list<Node*> *getNodes();
};

#endif

